import requests,os,json

url = "https://api.deepseek.com/user/balance"

api_key=os.environ.get('DEEPSEEK_API_KEY')
payload={}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer '+api_key
}

response = requests.request("GET", url, headers=headers, data=payload)

response_list=json.loads(response.text)

print(f'当前账户是否有余额可供API调用:{response_list['is_available']}\n货币:{response_list['balance_infos'][0]['currency']}\n总可用余额:{response_list['balance_infos'][0]['total_balance']}\n未过期的赠金余额:{response_list['balance_infos'][0]['granted_balance']}\n充值余额:{response_list['balance_infos'][0]['topped_up_balance']}')